package com.song.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.song.dao.JwtMapper;
import com.song.dao.TestMapper;
import com.song.pojo.Test;
import com.song.pojo.User;
import com.song.pojo.dto.JwtDto;
import com.song.pojo.vo.JwtVo;
import com.song.vo.CommonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author Klys
 * @Date 2023/5/31 21:57
 * @Description
 * @Version 1.0
 */
@RestController
public class JwtController {

    @Autowired
    private JwtMapper jwtMapper;

    @RequestMapping("/selectList")
    public CommonResult selectList(@RequestBody JwtDto jwtDto) {
        Page<JwtVo> page = new Page<JwtVo>().setSize(2).setCurrent(1);
        IPage<JwtVo> jwtVoIPage = jwtMapper.jwtList(page, jwtDto);
        return CommonResult.success(jwtVoIPage);
    }

    @RequestMapping("/update")
    public void test() {
        User user = new User("4", "klys", "klys");
        int update = jwtMapper.updateById(user);
        System.out.println(update);
    }

    @Autowired
    private TestMapper testMapper;

    @GetMapping("/test")
    public List t1() {
        List<Test> tests = testMapper.selectList(null);
        return tests;
    }
}
